#pragma once

#include <huniplacer/huniplacer.h>

#include <huniplacer_3d/RobotModel.h>
#include <huniplacer_3d/defines.h>

#include <huniplacer_3d/CrateContent.h>
#include <huniplacer_3d/Picking.h>

#include <string>

using namespace huniplacer;

class RobotModel;
class CrateContent;

class CrateModel : public Picking {
public:
	CrateModel(RobotModel* model,
			std::string n,
			point3 size,
			point3 location = point3(0, GROUND_PANE, 0),
			double rotation = 0);

	~CrateModel();
	
	void draw();
			
	void setLocation(point3& loc);
	void setRotation(double rotation);
	void setAlpha(float alpha);

	void set_content_color(int content_index, float r, float g, float b);

	double getRotation();
	point3 getLocation();
	point3 getSize();
	float getAlpha();

	void setNrBallsWidth(int rows);
	void setNrBallsDepth(int cols);

	int getNrBallsWidth();
	int getNrBallsDepth();
	
	int model_color;
private:
	RobotModel* m_Model;
	
	CrateContent** content;
	
	point3 m_Size;
	point3 m_Location;
	float m_Alpha;
	double m_Rotation;
	int nr_balls_width;
	int nr_balls_depth;
	
	void drawCube(float x, float y, float z, float width, float height, float depth);
};
